package com.org.csu.converter;

import com.org.csu.dto.HotwordDTO;
import com.org.csu.entity.HotWord;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author YigongLily
 * @version V1.0
 * Copyright (c) 2024, fengyang@hwadee.com All Rights Reserved.
 * @ProjectName:e-commerce-back
 * @Title: HotwordConverter
 * @Package com.org.csu.converter
 * @Description: htwConverter
 * @date 2024/12/15 18:12
 */

public class HotwordConverter {
    public static HotwordDTO convertHotWord(HotWord hotWord) {
        HotwordDTO hotwordDTO = new HotwordDTO();
        hotwordDTO.setWord(hotWord.getWord());
        hotwordDTO.setCount(hotWord.getHot());
        return hotwordDTO;
    }
    public static List<HotwordDTO> convertListHotword(List<HotWord> hotwordList) {
        return hotwordList.stream()
                .map(HotwordConverter::convertHotWord)
                .collect(Collectors.toList());
    }


}